package com.jt.provider.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RefreshScope  //假如希望配置中心内容发生变化,要对类中属性进行重新初始化,可使用此注解对类进行描述
@Slf4j
@RestController
public class ProviderLogController {
    @GetMapping("/provider/log/doLog01")
    public String doLog01(){
        System.out.println("==loLog01==");
        log.trace("==trace==");
        log.debug("==debug==");
        log.info("==info==");
        log.warn("==warn==");
        log.error("==error==");
        return "log config test";
    }
    @Value("${logging.level.com.jt:error}")
    private String logLevel;
    @GetMapping("/provider/log/doLog02")
    public String doLog02(){
        log.info("log level is {}",logLevel);
        return "log level is "+logLevel;
    }
}
